<template>
	<view class="template-invoice">

		<tn-list-view title="" unlined="bottom">
			<tn-list-cell v-for="(item, index) in dataList" :key="index">
				<view class="message">
					<view class="message__left">
						<tn-avatar text="票"></tn-avatar>
					</view>
					<view class="message__middle">
						<view class="message__name">{{item.invoiceHead}}</view>
						<view class="message__content tn-text-ellipsis">{{item.invoiceDutyNo}}</view>
					</view>
					<view class="message__right">
						<view class="message__tips">
							<text class="tn-icon-edit" @click="edit(item)"></text>
						</view>
					</view>
				</view>
			</tn-list-cell>
		</tn-list-view>

		<view class="add-button-view" @click="addInvoice">
			<tn-button class="common-button add-button" width="100%" shadow><text class="tn-icon-add" style="margin-right: 10rpx;"></text>添加发票信息</tn-button>
		</view>
	</view>
</template>

<script>
	import { list } from '@/api/account/invoiceInfo';
	export default {
		data() {
			return {
				dataList: []
			}
		},
		mounted() {},
		onShow() {
			this.getData();
		},
		computed: {},
		methods: {
			getData() {
				list({
					"page": 1,
					"pageSize": 10,
					"queryParams": {
						"F_createBy_eq": this.vuex_user.id,
					}
				}).then(res => {
					this.dataList = res.result?.items;
				}).finally(res => {});
			},
			edit(item){
				this.$common.navigateTo('/pages/tools/invoice/add?id=' + item.id);
			},
			addInvoice() {
				this.$common.navigateTo('/pages/tools/invoice/add');
			}
		}
	}
</script>

<style lang="scss" scoped>
	.template-invoice {
		.message {
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: space-around;

			&__left {
				width: 10%;
			}

			&__middle {
				width: 80%;
				padding-left: 20rpx;
				padding-right: 40rpx;
			}

			&__right {
				width: 10%;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
			}

			&__name {
				font-size: 32rpx;
				margin-bottom: 8rpx;
			}

			&__content {
				font-size: 26rpx;
				color: #838383;
			}

			&__tips {
				&__icon {
					font-size: 36rpx;
					color: #AAAAAA;
				}
			}
		}

		.add-button-view {
			position: absolute;
			width: 100%;
			bottom: 0px;

			.add-button {
				padding: 50rpx 0 !important;
				border-radius: 0px !important;
			}
		}
	}
</style>